package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RedisController {
    @Autowired
    private RedisTemplate redisTemplate;
    @RequestMapping("/save")
    public String doSave(){
        redisTemplate.opsForValue().set("userinfo","lisi");
        return "ok";
    }
    @RequestMapping("/get")
    public  String get(){
        return (String) redisTemplate.opsForValue().get("userinfo");
    }
}
